import requests
import execjs
import pprint

url = "https://api.qimai.cn/indexV2/getIndexRank"

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"
}

params = {
    "setting": "0",
    "genre": "6014"
}

with open("七麦.js", 'r', encoding='UTF-8') as file:
    js_code = file.read()

js = execjs.compile(js_code)
val = params.values()
analysis = js.call('get_data', list(val))
params['analysis'] = analysis
print(params)

res = requests.get(url, headers=headers, params=params)

pprint.pprint(res.json())
